import request from '@/utils/request'
import Qs from 'qs'

export function listEquipment(query) {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.equipment',
      _mt: 'list',
      ...query
    }
  })
}

export function createEquipment(data) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.equipment',
      _mt: 'create',
      ...data
    })
  })
}

export function updateEquipment(data) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.equipment',
      _mt: 'edit',
      ...data
    })
  })
}

export function deleteEquipment(id) {
  return request({
    method: 'post',
    params: {
      _gp: 'admin.equipment',
      _mt: 'delete',
      id: id
    }
  })
}
export function equipmentXiaLa() { // 设备下拉
  return request({
    method: 'get',
    params: {
      _gp: 'admin.equipmenttype',
      _mt: 'xiaList'
    }
  })
}
export function computerRoomXiaLa() { // 机房下拉
  return request({
    method: 'get',
    params: {
      _gp: 'admin.room',
      _mt: 'xiaList'
    }
  })
}
export function switchEquipment(data) {
  return request({
    method: 'post',
    params: {
      _gp: 'admin.equipment',
      _mt: 'discard',
      ...data
    }
  })
}

